package com.thot.timyag.web.dao.repository;

import java.util.List;

import com.thot.timyag.web.dao.entity.JarInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * @author yangjf
 * @time 2019-06-27 14:41
 */
@Repository
public interface JarInfoRepository extends JpaRepository<JarInfo, Integer> {
    /**
     * 根据名称和空间查询
     * @param jarName
     * @param jarWorkspace
     * @return
     */
    List<JarInfo> findByJarNameAndJarWorkspace(String jarName, String jarWorkspace);

    /**
     * 根据空间和名称匹配分页查询
     * @param workspace
     * @param jarName
     * @param pageable
     * @return
     */
    Page<JarInfo> findByJarWorkspaceAndJarNameLike(String workspace, String jarName, Pageable pageable);

    /**
     * 根据空间和名称和描述匹配 分页查询
     * @param workspace
     * @param jarName
     * @param description
     * @param pageable
     * @return
     */
    Page<JarInfo> findByJarWorkspaceAndJarNameLikeAndDescriptionLike(String workspace, String jarName, String description, Pageable pageable);

    /**
     * 根据名称和空间删除jar info
     * @param jarName
     * @param jarWorkspace
     */
    void deleteByJarNameAndJarWorkspace(String jarName, String jarWorkspace);
}
